{if $amode == 'normal'}
{include(file='header.tpl')}
                <p id="subnav">{$language_breadcrumb}: <a href="{$base_uri}">Webgis</a> &gt; <a href="{$base_uri}index.php?input=map&amp;m_id={$m_id}">{$map_title}</a> &gt; {$analysis_title}
                <h2>{$map_title}</h2>
{/if}
                <h3>{$analysis_title}</h3>
                {if $analysis_title == $language_analysis_histogram}
                    {if $histogram_data}
                    <table id="datatable" class="mapdata histogram">
                        <tr>
                            <th id="th_class">{$language_analysis_histogram_table_header_class}</th>
                            <th id="th_quantity">{$language_analysis_histogram_table_header_quantity}</th>
                            <th>{$language_analysis_histogram_table_header_relative_frequency}</th>
                            <th>{$language_analysis_histogram_table_header_width}</th>
                            <th>{$language_analysis_histogram_table_header_height}</th>
                        </tr>
                        {foreach $arr_values key item}
                            <tr id="th_class_{$key}"">
                                <td id="th_class_{$key}_d">{$item.class_name}</td>
                                <td>{$item.cases}</td>
                                <td>{$item.relative_frequency}</td>
                                <td class="width">{$item.width_percentaged}</td>
                                <td class="height">{$item.height}</td>
                            </tr>
                        {/foreach}
                    </table>
    		        <div id="raphael_histogram"></div>
                    {if $amode == 'normal'}  
    		          <script type="text/javascript" src="{$base_uri}output/theme/default/js/src/configurable.js"></script>
    		        {/if} 
    		        <script type="text/javascript" src="{$base_uri}output/theme/default/js/raphael.js"></script>
                    <script type="text/javascript" src="{$base_uri}output/theme/default/js/g.raphael.js"></script>
    		        <script type="text/javascript" src="{$base_uri}output/theme/default/js/histogram.js"></script>
    		        {else}
    		        <p class="error">{$language_error_no_histogram_data}</p>
    		        {/if}
		        {elseif $analysis_title == $language_analysis_boxplot}
		          <form action="{$base_uri}index.php?input=map&m_id={$map_id}&analysis=boxplot" method="post">
		              <p>
                        <label for="hinge">{$language_label_whisker_length}</label>
                        <select name="hinge" id="hinge">
                            <option value="1.5"{if $hinge == 1.5} selected{/if}>1.5</option>
                            <option value="3"{if $hinge == 3} selected{/if}>3.0</option>
                        </select>
                        <input type="submit" value="{$language_submit_select}" />
                    </p>
		          </form>
		        <div class="group">
                    <div id="boxplot"></div>
                    <table id="datatable">
                        {foreach $arr_values.values key item}
                        <tr id="plot_value_{$key}" style="display: none;">
                            <td>{$item.region}</td>
                            <td>{$item.f_value}</td>
                        </tr>
                        {/foreach}
                    </table>
                </div>
		        <ul class="boxplot-values" style="display: none;">
                    {foreach $arr_values key item}
                        <li id="plot_{$key}">
                        {if $key != 'values'}
                        {$item}
                        {else}
                        <ul>
                        {foreach $item i_key i_item}
                            <li>{$i_item.value}</li>
                        {/foreach}
                        </ul>
                        {/if}
                        </li>
                    {/foreach}
                </ul>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/src/configurable.js"></script>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/raphael.js"></script>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/g.raphael.js"></script>
		<script type="text/javascript" src="{$base_uri}output/theme/default/js/boxplot.js"></script>
		          {elseif $analysis_title == $language_analysis_spatial}
		        <div class="group">
		              <h4>Moran's I: <span id="morans_i">{$moran}</span></h4>
                    <div id="scatterplot"></div>
                    <table id="datatable">
                        {foreach $arr_data key item}
                        <tr id="plot_value_{$key}" class="plot_value">
                            <td>{$item.region}</td>
                            <td>{$item.f_value}</td>
                            <td class="w_value">{$item.value}</td>
                            <td class="w_n_value">{$item.n_value}</td>
                        </tr>
                        {/foreach}
                    </table>
                </div>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/src/configurable.js"></script>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/raphael.js"></script>
		          <script type="text/javascript" src="{$base_uri}output/theme/default/js/moran_scatterplot.js"></script>
                {elseif $analysis_title == $language_analysis_diagram}
                {if $amode == 'normal'}
		          <form action="{$base_uri}index.php?input=map&m_id={$map_id}&analysis=diagram" method="post">
		              <p>
                        <label for="chart_sort">{$language_label_order_by}</label>
                        <select name="chart_sort" id="chart_sort">
                            <option value="1"{if $sort_order == 1} selected{/if}>{$language_option_region_id}</option>
                            <option value="2"{if $sort_order == 2} selected{/if}>{$language_option_cases}</option>
                        </select>
                        <input type="submit" value="{$language_submit_sort}" />
                    </p>
		          </form>
		        {/if}
                <div class="group" id="chartdiv">
                <ul id="chart"{if $amode != 'normal'} style="display: none;"{/if}>
                    {foreach $arr_values key arr_item}
                            <li class="group"><span class="region">{$arr_item.region}</span>
                            {foreach $arr_item.dimension d_key d_item}{if $d_key != 'cases'}
                                {$d_item}{/if}
                            {/foreach}
                            <span style="border-left-width: {$arr_item.share}px;" class="value" title="{$arr_item.region}: {$arr_item.cases} ({$__.map_title})">{$arr_item.cases}</span></li>
                    {/foreach}
                </ul> 
                <div id="raphael_chart"></div>             
                </div>
                {if $amode == 'normal'}  
		          <script type="text/javascript" src="{$base_uri}output/theme/default/js/src/configurable.js"></script>
		        {/if}
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/raphael.js"></script>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/g.raphael.js"></script>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/g.bar.js"></script>
                <script type="text/javascript" src="{$base_uri}output/theme/default/js/chart.js" ></script>
                {elseif $analysis_title == $language_analysis_table}
                <div id="datatable-div" class="group">
                    <table id="datatable" class="mapdata">
                        {foreach $arr_meta_data key item}
                        <tr>
                            {if $item.dimension}
                            <th rowspan="{$item.dimension}"{if !$item.values} colspan="2"{/if}>{$language_region}</th>
                            {/if}
                            {for i 1 $item.iteration}
                                {foreach $item.values i_key i_item}
                                    <th {if $_.item.length > 0}colspan="{$_.item.length}"{/if}>{$i_item}</th>
                                {/foreach}
                            {/for}
                        </tr>
                        {/foreach}                        
                        {foreach $arr_values key arr_item}
                        <tr>
                            <td>{$key}</td>
                            {foreach $arr_item i_key item}
                                <td>{$item.cases}</td>
                            {/foreach}
                        </tr>
                    {/foreach}
                    </table>
                </div>
                {else}
                <dl class="group">
                    <dt>{$language_analysis_stats_mean}</dt>
                    <dd>{$arr_values.mean}</dd>
                    <dt>{$language_analysis_stats_stddev}</dt>
                    <dd>{$arr_values.stddev}</dd>
                    <dt>{$language_analysis_stats_min}</dt>
                    <dd>{$arr_values.min}</dd>
                    <dt>{$language_analysis_stats_max}</dt>
                    <dd>{$arr_values.max}</dd>
                    <dt>{$language_analysis_stats_n}</dt>
                    <dd>{$arr_values.n}</dd>
                    <dt>{$language_analysis_stats_sum}</dt>
                    <dd>{$arr_values.sum}</dd>
                </dl>
                {/if}
{if $amode == 'normal'}
                <p class="button"><a href="{$base_uri}index.php?input=map&amp;m_id={$m_id}">{$language_back_to_map}</a>
{include(file='footer.tpl')}
{/if}
